
local ui = class.panel.create([[textures\black32.blp]],500,200,300,450)
ui:set_level(99)
ui:hide()
ui.icon = ui:add_panel([[ReplaceableTextures\CommandButtons\BTNStaffOfSilence.blp]],20,20,64,64)
ui.title = ui:add_text('荒古宝典[|cffff00ff史诗|r] +9',100,20,200,32,12,4)
ui.quality = ui:add_text('T1',100,52,200,32,12,4)
ui.tip = ui:add_text('',20,100,ui.w - 40,0,10)
ui.line1 = ui:add_panel([[ReplaceableTextures\TeamColor\TeamColor10.blp]],20,10,ui.w - 40,3)
ui.abi = ui:add_text('',20,100,ui.w - 40,0,10)

ui.line2 = ui:add_panel([[ReplaceableTextures\TeamColor\TeamColor10.blp]],20,10,ui.w - 40,3)
ui.tztp = ui:add_text('',20,100,ui.w - 40,0,10)

local text = [[
|cffff9900属性：|r
攻击速度+100%

|cff00ff00强化属性：|r
基础攻击+100
攻击速度+50%]]
local abi = [[
|cffff9900★毁灭:|r|n每次攻击敌人时，造成的伤害提高|cffff0000100|r%，最高叠加|cffff0000+50|r次。|n
|cffff9900★★神射手:|r|n远程英雄的|cffff9900攻击距离|r提升|cffff0000100|r码|n
|cffff9900★★★坚定:|r|n来自|cffff9900精英怪|r的|cffff0000伤害减少|r|cff00ff00100%|r。|n]]
local tz = [[T1套装(5/6)|n生命加成+3%|n生命加成+3%,攻击加成+4%|n生命加成+3%,攻击加成+4%,护甲加成+5]]

function ui:set_tip(text,abi,tz)
    self.tip:set_text(text)
    self.abi:set_text(abi or '')
    self.tztp:set_text(tz)
    self.line1:set_position(self.line1.x,self.tip:get_height() + self.tip.y + 5)
    self.abi:set_position(self.abi.x,self.line1:get_height() + self.line1.y + 5)
    self.line2:set_position(self.abi.x,self.abi:get_height() + self.abi.y + 5)
    self.tztp:set_position(self.tztp.x,self.line2:get_height() + self.line2.y + 5)
    if abi then
        self.line1:show()
    else
        self.line1:hide()
    end

    self:set_height(self.tztp:get_height() + self.tztp.y + 25)
end

ui:set_tip(text,abi,tz)

ac.game:event '存档装备-显示文本'(function(_,button,info,anchor)
    local tip1 = format_obj(info, info.tip)
    local tip2 = format_obj(info, info.abi_tip)
    local art = format_obj(info, info.art)
    local title = format_obj(info, info.title)
    local tztp = get_cdtz_tip(info['前缀'])
    ui.icon:set_normal_image(art)
    ui.title:set_text(title)
    ui.quality:set_text(info['前缀'])
    ui:set_tip(tip1,tip2,tztp)
    if anchor then
        button:set_tooltip_follow(ui, anchor)
    else
        local x,y = button:get_real_position()
        ui:set_position(x + button.w,y + button.h)
    end
    ui:show()
end)


ac.game:event '存档装备-隐藏文本'(function(_,button,info,anchor)
    ui:hide()
end)